
{%- if bigo_pixels -%}
  <script>
    window.bgdataLayer = window.bgdataLayer || [];
    function bge() {
      bgdataLayer.push(arguments);
    }
    {% for pixel in bigo_pixels %}
        bge('init', "{{pixel}}");
    {% endfor %}

    setTimeout(function(){
      bge('event', 'page_view');
    {%- if template == 'product_detail' -%}
        bge('event', 'ec_detail_view');
    {%- endif -%}

    {%- if template == 'order_contact_information' or template == 'orderonepage_index'  -%}
          bge('event', 'ec_order');
    {%- endif -%}
    },500)

  </script>
  {% for pixel in bigo_pixels %}
  <script async src="https://api.imotech.video/ad/events.js?pixel_id={{pixel}}"></script>
  {% endfor %}

  <script type="text/javascript">
    function callback_bigo_add_to_cart(ecdata) {
        bge('event', 'ec_add_cart');
    }

    function callback_bigo_generate_lead() {}

    function callback_bigo_share_product(ec_data, platform) {}

    function callback_bigo_begin_checkout() {}

    function callback_bigo_login() {}

    function callback_bigo_remove_from_cart(ecdata) {}

    function callback_bigo_add_address_information() {}

    function callback_bigo_add_shipping_information() {}

    function callback_bigo_add_payment_information() {}

    function callback_bigo_sign_up() {
        bge('event', 'ec_register');
    }
  </script>
{%- endif -%}
